from tkinter import Tk
from tkinter import Menu
import tkinter as tk

from database.supplier_function_admin.addsupplier import AddSupplier
from database.supplier_function_admin.admendsupplier import AdmendSupplier
from database.supplier_function_admin.countsupplier import CountSupplier
from database.supplier_function_admin.deletesupplier import DeleteSupplier
from database.supplier_function_admin.searchsupplier import SearchSupplier

def SupplierPage():
    admin_supplier_screen = Tk()
    admin_supplier_screen.title('供应商信息管理')
    screen_width, screen_height = admin_supplier_screen.maxsize()
    # 窗口的宽和高
    width = 410
    height = 140
    centre = '%dx%d+%d+%d' % (width, height, (screen_width - width) / 2,
                              (screen_height - height) / 2)
    admin_supplier_screen.geometry(centre)
    welcome = tk.Label(admin_supplier_screen, text='请选择功能！', font=('楷体', 20))
    welcome.place(x=120, y=40)

    def add():
        AddSupplier()

    def amend():
        AdmendSupplier()

    def search():
        SearchSupplier()

    def delete():
        DeleteSupplier()

    def count():
        CountSupplier()

    def returnn():
        admin_supplier_screen.destroy()

    menu_employ = Menu(admin_supplier_screen)
    menu_employ.add_command(label='添加', command=add)
    menu_employ.add_command(label='修改', command=amend)
    menu_employ.add_command(label='查询', command=search)
    menu_employ.add_command(label='删除', command=delete)
    menu_employ.add_command(label='统计', command=count)
    menu_employ.add_command(label='返回', command=returnn)

    admin_supplier_screen.config(menu=menu_employ)

    admin_supplier_screen.mainloop()


if __name__ == '__main__':
    SupplierPage()
